<div class="top-bar-2 rounded-top templates-list">
	<?php echo $html->link(__('Add', true), array('controller' => 'templates', 'action' => 'add'), array('class'=>'btn-2 nyroModal right add')); ?>
	<?php echo $html->link(__('See all', true), array('controller' => 'templates', 'action' => 'add'), array('class'=>'btn-2 nyroModal right seeall')); ?>
	<?php __('Your templates'); ?>
</div>
<div class="box-content-2 rounded-bottom templates-list">
	<div class="holder">
		<?php foreach($templates as $template):?>
			
		<div class="template rounded">
			<h4 class="title rounded">
				<?php echo $template['Template']['title']; ?>
				<span>(<?php echo $template['Type']['title']; ?>)</span>
				<?php echo $html->link(__('Edit', true), array('controller' => 'templates', 'action' => 'edit', $template['Template']['id']), array('class'=>'anonymous right')); ?></h4>
				<div class="stats-holder">
					<dl class="stats">
						<dd>
							<?php echo $timeUtility->parseTag($template['Template']['initial_time_total'], 'time')?>
						</dd>
						<dt><?php __('Total time')?></dt>
					</dl>

					<dl class="stats">
						<dd>
							<?php echo $timeUtility->parseTag($template['Template']['initial_distance'], 'distance')?>
						</dd>
						<dt><?php __('Distance')?></dt>
					</dl>

					<dl class="stats">
						<dd>
							<?php echo $timeUtility->parseTag($template['Template']['initial_heartrate'], 'heartrate')?>
						</dd>
						<dt><?php __('Av. heartrate')?></dt>
					</dl>

					<dl class="stats">
						<dd>
							<?php echo $timeUtility->parseTag($template['Template']['power_zone'], 'power_zone')?>
						</dd>
						<dt><?php __('Power zone')?> <?php echo $template['Template']['power_zone']?></dt>
					</dl>
			</div>
		</div>
		<?php endforeach; ?>
		<?php //echo $html->link(__('See all', true), array('controller' => 'templates', 'action' => 'index'), array('class'=>'more left')); ?>
			<input type="text" id="template-filter" class="left" value="filter" />
	</div>

</div>
<script type="text/javascript">
	jQuery(document).ready(function(){
		
		// Show/hide more info for templates in sidebar
		jQuery('.template .title').toggle(
		  function () {
		    $(this).parent().find('.stats-holder').fadeIn();
		  },
		  function () {
		    $(this).parent().find('.stats-holder').fadeOut();
		  }
		);
		
	});
</script>